<script type="text/javascript">
var laytpl;
var form;
//渲染模板引擎
layui.use(['laytpl','form'], function(){
    laytpl = layui.laytpl;
    form = layui.form;
	form.render();
});
/**
 * 订单操作
 * @param fun
 * @param order_id
 */
function orderAction(fun, order_id){
    eval(fun+"("+order_id+")");
}


/**
 * 关闭订单
 * @param order_id
 */
function orderClose(order_id){
	layer.confirm('确定要关闭该订单吗?', function() {
		$.ajax({
			url: ns.url("hotel://hotel/order/close"),
			data: {order_id : order_id},
			dataType: 'JSON',
			type: 'POST',
			success: function(res) {
				layer.msg(res.message);
				
				if (res.code == 0) {
					location.reload();
				}
			}
		});
	}, function () {
		layer.close();
	});
}



/**
 * 线下支付
 * @param order_id
 */
function offlinepay(order_id) {

	$.ajax({
		url: ns.url("hotel://hotel/order/offlinePay"),
		data: {order_id: order_id},
		dataType: 'JSON',
		type: 'POST',
		success: function (res) {
			layer.msg(res.message);

			if (res.code >= 0) {
				location.reload();
			}
		}
	});

}

</script>
